﻿<?php
defined("_VALID_ACCESS") || die('Direct access forbidden');
class SCTV_MaintenanceSmsInstall extends ModuleInstall {
    public function install() {
        $fields = array(
            array('name'=>_M('In/Out'), 'type'=>'checkbox', 'required'=>true, 'visible'=>true, 'display_callback'=>array('SCTV_MaintenanceSmsCommon', 'display_in_out')),
            array('name'=>_M('Maintenance'), 'type'=>'select', 'param'=>array('SCTV_Maintenance'=>'Maintenance Code'), 'required'=>false, 'visible'=>false),
            array('name'=>_M('SMS ID'), 'type'=>'integer', 'required'=>true, 'visible'=>false),
            array('name'=>_M('Employee'), 'type'=>'crm_contact', 'param'=>array('field_type'=>'select', 'crits'=>array(), 'format'=>array('CRM_ContactsCommon','contact_format_default')), 'required'=>false, 'visible'=>true),
            array('name'=>_M('Phone Number'), 'type'=>'text', 'param'=>16, 'required'=>true, 'visible'=>true),
            array('name'=>_M('Content'), 'type'=>'text', 'param'=>160, 'required'=>true, 'visible'=>true),
            array('name'=>_M('Date'), 'type'=>'date', 'required'=>true, 'visible'=>true),
            array('name'=>_M('Time'), 'type'=>'time', 'required'=>true, 'visible'=>true)
        );

        Utils_RecordBrowserCommon::install_new_recordset('SCTV_MaintenanceRequirementSms', $fields);
        Utils_RecordBrowserCommon::set_caption('SCTV_MaintenanceRequirementSms', _M('Maintenance Requirement SMS'));
        Utils_RecordBrowserCommon::add_default_access('SCTV_MaintenanceRequirementSms');
		
		$fieldssms = array(
			array('name'=>_M('SMS ID'), 'type'=>'integer', 'required'=>true, 'visible'=>false),
			array('name'=>_M('Content'), 'type'=>'text', 'param'=>320, 'required'=>true, 'visible'=>true),
			array('name'=>_M('Receiver'), 'type'=>'text', 'param'=>160, 'required'=>true, 'visible'=>true),
			array('name'=>_M('Date'), 'type'=>'date', 'required'=>true, 'visible'=>true),
			array('name'=>_M('Time'), 'type'=>'time', 'required'=>true, 'visible'=>true)
		);

		Utils_RecordBrowserCommon::install_new_recordset('SCTV_MaintenanceSms', $fieldssms);
		Utils_RecordBrowserCommon::set_caption('SCTV_MaintenanceSms', _M('Maintenance SMS'));
		
        Utils_RecordBrowserCommon::new_addon('SCTV_Maintenance', 'SCTV_MaintenanceSms', 'maintenance_addon', _M('Maintenance SMS'));

        return true;
	}
    public function uninstall() {
        Utils_RecordBrowserCommon::uninstall_recordset('SCTV_MaintenanceSms');
		Utils_RecordBrowserCommon::uninstall_recordset('SCTV_MaintenanceRequirementSms');
        return true;
    }
 	public function requires($v) {
		return array(
		);
	}
	
    public function info() {
 
        return array( 'Author'=>'Tran Trong Hieu',
            'License'=>'SCTV',
                     'Description'=>'Maintenance SMS');
 
    }
 
    public function simple_setup() {
 
        return array('package' => __('SCTV Maintenance SMS'), 'version'=>'1.0');
 
    } 
    public function version() {
 
        return array('1.0');
 
    }
}
 
?>